import { createStore } from "vuex";

export default createStore({
  state: {
    flag: false,
    residents: {},
    rights: false,
    stalg: false,
    deleteflag: false,
    info: window.localStorage.getItem("info")
      ? JSON.parse(window.localStorage.getItem("info") as string)
      : {},
  },
  getters: {},
  mutations: {
    bool(state) {
      state.flag = !state.flag;
    },
    information(state, list) {
      state.residents = list;
    },
    witch(state) {
      state.stalg = !state.stalg;
    },
    deletebool(state) {
      state.deleteflag = !state.deleteflag;
    },
    management(state, infos) {
      localStorage.setItem("info", JSON.stringify(infos));
      state.info = infos;
    },
    rig(state) {
      state.rights = !state.rights;
    },
  },
  actions: {},
  modules: {},
});
